Graph visualization. Animation

Lecture 6

732A98

Graph visualization

  • Visualizes relational information
    • Weighted/unweighted, directional/bidirectional
  • Applications
    • Social networks
    • Biological networks (genetic)
    • Computer networks
    • Railway/bus networks

Tree visualization

  • Space-filling methods (sunburst chart, treemaps, circle packing)
  • Non-space filling methods (trees)
  • Aesthetics: node color/ size, link color/size

Treemaps, Circle packing and Sunburst diagrams

  • Recursively divides the space into areas according to the hierarchy (e.g. catalogue structure)
  • Aesthetics: size and color
    • Assuming: size(parent)=size(children)

Treemaps

  • Analysis: Comparing size/color of hierarchies between/within different levels

Example: World population

Circle packing

Example: Hierarchy for Flare ActionScript Library

More examples here

Sunburst

Example: Hierarchy for Flare ActionScript Library

Sunburst

Example: Hierarchy for Flare ActionScript Library

Tree

  • Aesthetics: Node/link size, node/link color
  • Can be used for classification result analysis
  • Analysis
    • Analyse each branch and terminal nodes
    • Compare information between nodes
    • Compare information between branches

Tree

Graph visualization

  • Node-link diagram
    • Conventions
    • Contraints
    • Aesthetics
  • Layout has great impact (influences understanding a lot)

  • Different layouts proposed
    • Force-directed layout - Repulsive and Spring forces - Optimization used to find equilibrium
    • Fixed layouts: circular, line,…
    • Minimizing other objectives (e.g. symmetry, edge crossing)

Graph visualization

Graph visualization

Analysis:

  • Which nodes are hubs?
  • Which links are strongest?
  • Which nodes are n steps away from some node?
  • Components with strong connections?
    • Relationships to groups?
  • How are different groups connected?
  • Shortest path between nodes
  • Community detection (densely connected nodes)
  • Other interesting substructures

Graph visualization

Graph visualization

  • Graph can be represented as adjacency matrix
  • Seriation methods can be used
  • Communities can be detected by heatmaps
WashingtonPost.comNew York PostAOL.comMSNBCABCCNNFOX NewsReuters.comYahoo NewsGoogle NewsUSA TodayWashington PostNYTimes.comNY TimesLA TimesWall Street JournalBBCWashingtonPost.comAOL.comABCFOX NewsYahoo NewsUSA TodayNYTimes.comLA TimesBBC
05101520Values

Graph Visualization in R

  • A plenty of packages available
    • igraph: rich functionality, poor graphics
    • visNetwork: interactive graph visualization, can use igraph objects
    • ggraph: static graphs, based on the grammar of graphics, can use igraph
    • ggnet2 in GGally: static graphs

Graph Visualization in R

  • Describing graph objects - very package dependent
    • igraph/visNetwork/ggraph:
      • Nodes: data frame with “id” column (and other attrs)
      • Edges: data frame with “from” and “to” columns (and other attrs)

Animation

  • Static plot of data video
  • Eye is drawn to similar motions and outlying motions
  • Advantages
    • Effective at attracting attention
    • Time=one extra aesthetics
    • Easily perceived in peripheral vision many features can be captured at one time point
  • Disadvantages
    • Unappropriate transformation (transition) false conclusions
    • Speed of the graphics may hide important details/make boring

Gapminder

See https://www.gapminder.org/tools/

  • Gapminder is
    • A database that stores important world statistics (by country)
    • Each dataset can be analysed online with Motion Chart
    • Popularized by Hans Rosling
  • Check “Life expectancy” (years) in Gapminder

Gapminder

Life expectancy set

  • How the life expectancies change over 200 years
  • Which countries had in general the highest life expectancy? Lowest lifexpectancy? Highest income level? Lowest income level?
  • What happened after 1946 and why?
  • Compare development of China and USA (mark this countries and use “trace”)

How to create an animation?

  • Limited amount of timepoints
  • Smooth transition is desired

  • For each aesthetics x, consider interpolation x(t)
    • How to create?
      • Linear interpolation, splines, kernel smoothers…
      • Compute relative path length s(t):
        • Parameterize with s control the velocity of animation
      • Insert intermediate frames t1,,tn with x(t1),x(tn)

How to create an animation?

How to create an animation?

Inserting intermediate values:

Animation- recommendations

  • Use simple transitions
  • Maintain valid data during transitions
    • Example: using splines
  • Be careful when using interpolations: use appropriate models
  • If trajectory is stable, use ease-in, ease-out
  • Make transition as long as needed but no longer.
  • Minimize occlusion

Animation in R

1e+031e+041e+05406080
AfricaAmericasAsiaEuropeOceania~year: 1952195219571962196719721977198219871992199720022007gdpPercaplifeExpcontinentpopPlay

Animation in R

Example: power function

library(plotly)

m=matrix(nrow=0,ncol=3)
for (a in seq(0,3,by=0.03)) {
  x<-seq(0,2,0.01)
  y<-x^a
  m<-rbind(m,cbind(x,y,a))
}

df=as.data.frame(m)

plot_ly(df, x=~x, y=~y, frame =~a)%>%add_lines()%>%
  animation_opts(frame = 100, easing = "cubic", redraw = F
)

Animation in R

Example: power function

00.511.5202468
trace 0a: 000.210.420.630.841.051.261.471.681.892.12.312.522.732.94xyPlay

2D-tours

  • MDS and PCA projections
    • Is one projection enough to understand data?

2D-tours

  • Idea
    • Investigate various projections
    • Connect them into animation
  • What to analyze?
    • Same as in scatterplots plus
    • Which variables contribute to projections
      • Patterns in lower dimensional manifold?
  • Types of 2d-tours: grand tour and guided tour

2D-tours

  • Grand tour for Car data
mpgdisphpdratwtqsec
step: 001.533.074.66.137.679.210.712.3Play

Projection math

  • Data matrix X=[n×p]
  • Projection matrix A=[p×d], d=2
    • Rows in A: contribution of ith coordinate to projection
    • Columns in A: coordinate of projecting vectors in Rp
  • Projected data Z=XA

  • Example: X=(243621299), A=(100100)

Grand tour

  • Idea: explore projections randomly
  1. Select some projection A1
  2. Select next projection randomly A2
  3. Create shortest path projections A11,,A1k from A1 to A2
  4. Select next projection randomly A3

Grand tour

Guided tour

  • Idea: focus on “interesting” projections
    • Interest measure: projection pursuit index I(XA)
    • Go through local maxI(XA)


- Various projection pursuit indices: Holes, central mass,…

Guided tour

Algorithm:

  • Select some projection Aa, calculate Ia
  • For i=1,2,…
    • Ai=Aa+ciB, B- random direction, ci- “cooling parameter”
    • Move to Ai with probability depending on ΔI (and create shortest path intermediate projections)
    • Set Aa=Ai if moved.

Guided tour

  • Note: path goes often through same points…

Read Home